import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xvideos/assets_tool/images.dart';
import 'package:xvideos/hj_model/video_model.dart';
import 'package:xvideos/hj_page/find/rank_module/video_rank_cell.dart';
import 'package:xvideos/hj_utils/widget_utils.dart';
import 'package:xvideos/tools_base/widget/net_image_widget.dart';

import '../pic_collect/pics_detail_page.dart';

//图集排行榜item
class ImageRankItem extends StatelessWidget {
  final int index;
  final VideoModel? movie;

  const ImageRankItem(
      this.index,
      this.movie,
      );

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        Get.to(PicsDetailPage(id: movie?.id), preventDuplicates: false);
      },
      child: Container(
        height: 108,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            SizedBox(
              width: 80,
              height: 108,
              child: NetworkImageLoader(
                imageUrl: movie?.cover ?? '',
                borderRadius: 8,
              ),
            ),
            SizedBox(width: 10),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  Row(
                    children: [
                      Image.asset(rankImgPath(index), width: 24),
                      SizedBox(width: 4),
                      Text(
                        "NO.${index + 1}",
                        style: TextStyle(
                          color: rankColor(index),
                          fontSize: 14,
                        ),
                      ),
                    ],
                  ),
                  Text(
                    "${movie?.title ?? ''}",
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyle(
                      color: Color(0xE5FFFFFF),
                      fontSize: 12,
                      height: 1.5,
                    ),
                  ),
                  Row(
                    children: [

                      Image.asset(
                        "eye_grey.webp".homePath,
                        width: 14,
                        height: 14,
                      ),
                      SizedBox(width: 5),
                      Text(
                        movie?.playCount?.humanizeFormat ?? "0",
                        style: TextStyle(color: Color(0xff989898), fontSize: 12),
                      ),
                      8.sizeBoxW,
                      Image.asset(
                        "collect_start.webp".homePath,
                        width: 14,
                        height: 14,
                      ),
                      SizedBox(width: 5),
                      Text(
                        movie?.collectCount?.humanizeFormat ?? "0",
                        style: TextStyle(color: Color(0xff989898), fontSize: 12),
                      )
                    ],
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}


